﻿using IMark.DAO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IMark
{
    public partial class DangNhap : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Session["User"]==null)
            {
                if (Request["User"] != null)
                {
                    string User = Request["User"];
                    string Pass = Request["Pass"];
                    KHACH_HANG result = KhachHangModels.DangNhap(User, Utils.ConvertMD5(Pass));
                    if (result != null)
                    {
                        Session["User"] = result;
                        Response.Redirect("LichSuDatHang.aspx");
                    }

                    else
                        error.InnerHtml = "<div class='alert alert-danger'>Username hoặc password không đúng !!!</div>";
                }
            }
            else
            {
                Response.Redirect("LichSuDatHang.aspx");
            }
        }
    }
}